package com.findMoneyGame.pages.shop.improvements {

	import flash.display.MovieClip;
	import flash.events.Event;

	import com.findMoneyGame.models.User;
	import com.findMoneyGame.models.Model;


	public class ImprovementItem extends MovieClip {
		private var frames = ['disable', 'I', 'II', 'III', 'IV', 'V', 'VI'];

		protected function get user () { return User.getInst(); }
		protected function get frameIndex () { return 0; }
		protected function get labelText () : String { return ''; }

		public function ImprovementItem () {
			user.addEventListener(Model.UPDATE, function (e : Event) { refresh(); });
			refresh();
		}
		private function refresh () {
			gotoAndStop(frames[frameIndex]);
			if (frameIndex > 0) {
				var label = getChildByName('label');
				if (label != null) {
					label.text = labelText;
				}
			}
		}
	}
}